(function() {
	var e, d, h = location.protocol + "//" + location.host + "/img/v.gif?";
	var c = function(i) {
		var i = i.replace(/#/, "");
		if (i == "phone") {
			baidu("#mailRegTab").removeClass("active");
			baidu("#phoneRegTab").addClass("active");
			d && d.hide();
			e && e.show()
		} else {
			baidu("#mailRegTab").addClass("active");
			baidu("#phoneRegTab").removeClass("active");
			d && d.show();
			e && e.hide()
		}
	};
	var g = function(k, j) {
		var k = k.replace(/#/, "");
		if (k == "") {
			k = "mail"
		}
		if (k == "phone") {
			baidu.dom.removeClass("mailRegTab", "active");
			baidu.dom.addClass("phoneRegTab", "active");
			d && d.hide();
			e && e.show()
		} else {
			baidu.dom.addClass("mailRegTab", "active");
			baidu.dom.removeClass("phoneRegTab", "active");
			d && d.show();
			e && e.hide()
		}
		var i = new Image();
		i.src = h + "type=" + j + "&regType=" + k;
		i.style.display = "none"
	};
	var b = function(j) {
		var i = location.href.replace(/#.*/, "");
		i += "#" + j;
		location.href = i;
		g(j, 0)
	};
	var a = null;
	baidu("#floatLogin").click(function(i) {
				T.event(i).preventDefault();
				if (!a) {
					a = passport.pop.init({
								cache : true,
								apiOpt : {
									product : _config.tpl,
									tangram : false,
									u : _config.u,
									staticPage : _config.v3Staticpage
								},
								registerLink : _config.registerLink
							})
				}
				a.show()
			});
	(function f() {
		passport.use("reg", {
					tangram : false,
					regPhoneOnly : false
				}, function(i) {
					d = new i.passport.reg({
								product : _config.tpl,
								u : "",
								retu : _config.retu,
								userName : !_config.noUsername,
								staticPage : _config.v3Staticpage
							});
					d.render("normal_reg");
					d.on("validateSuccess", function(j) {
							});
					e = new i.passport.reg({
								product : _config.tpl,
								userName : !_config.noUsername,
								retu : _config.retu,
								isPhone : true,
								passwordConfirm : false,
								staticPage : _config.v3Staticpage
							});
					e.render("phone_reg");
					e.on("validateSuccess", function(k) {
								if (k.validate.field == "phone") {
									var j = k.target._ids.verifyCodeSendWrapper;
									baidu.dom("#" + j).addClass("smsSendHover")
								}
							});
					e.on("validateError", function(k) {
								if (k.validate.field == "phone") {
									var j = k.target._ids.verifyCodeSendWrapper;
									baidu.dom("#" + j)
											.removeClass("smsSendHover")
								}
							});
					baidu.event.on("mailRegTab", "click", function(j) {
								if (!baidu.dom(this).hasClass("active")) {
									b("mail")
								}
							});
					baidu.event.on("phoneRegTab", "click", function(j) {
								if (!baidu.dom(this).hasClass("active")) {
									b("phone")
								}
							});
					g(location.hash, 1)
				})
	})()
})();